<%@ page language="java" pageEncoding="UTF-8" %>
<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script type="text/javascript" src="${ctx}/static/rensou/advance.js"></script>
<div class="navbar navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
			<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
			</a>
			<div class="brand">监控中心</div>
			<div class="nav-collapse">
				<ul class="nav">
				  <li class='analysis' id="head_1"><a href="${ctx}/collector/nodeManager">采集管理</a></li>
				  <li class='subject' id="head_2"><a href="${ctx}/collector/monitor/managerIndex">采集监控</a></li>
				  <shiro:hasPermission name="user:edit">
				  	<li class='subject' id="head_3"><a href="${ctx}/profile/intouserinfo">帐号管理</a></li>
				  </shiro:hasPermission>
				  	
				</ul>
				<ul class="nav pull-right">
					<shiro:guest><li><a data-toggle="modal" href="#loginForm">登录</a></li></shiro:guest>
					<shiro:user>
					<li class="dropdown">
						<a href="#" class="dropdown-toggle" data-toggle="dropdown"><shiro:principal property="name" /><b></b></a>
					</li>
					<li><a href="${ctx}/logout">登出</a></li>
					</shiro:user>
				</ul>
			</div>
        </div>
      </div>
</div>



<form action="${ctx}/login" method="post" class="form-horizontal modal hide fade" id="loginForm">
	<fieldset>
		<div class="modal-header">
			<a data-dismiss="modal" class="close">×</a>
				<h3>用户登录</h3>
		</div>           
		<div class="modal-body">
			<%
				String error = (String) request.getAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME);
				if(error != null) {
			%>
				<div class="alert alert-error input-medium controls">
					<button class="close" data-dismiss="alert">×</button>登录失败，请重试.
				</div>
			<%  }  %>
			<div class="control-group">
				<label for="focusedInput" class="control-label">用户名</label>
				<div class="controls">
					<input type="text" name="username" value="" class="span3 focused" placeholder="输入用户名...">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">密码</label>
				<div class="controls">
					<input type="password" name="password" placeholder="输入密码..." class="span3" />
				</div>
			</div>
		</div>
		<div class="modal-footer">
			<input type="submit" class="btn" value="登录" />
		</div>
	</fieldset>
</form>
